package ${packageInfo.packageName}.service;

import ${packageInfo.packageName}.entity.${packageInfo.className};
import ${packageInfo.packageName}.entity.FrameMenu;
import ${packageInfo.packageName}.mapper.${packageInfo.className}Mapper;
import ${packageInfo.packageName}.mapper.FrameMenuMapper;
import com.yangle.frame.common.service.BaseService;
import com.yangle.frame.common.utils.MapperUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.List;

/**
* Created by yangle on 2018/5/27.
*/
@Service
public class ${packageInfo.className}Service implements BaseService<${packageInfo.className}> {
@Autowired
private ${packageInfo.className}Mapper ${(packageInfo.className)?uncap_first}Mapper;

public List<${packageInfo.className}> getAll(${packageInfo.className} ${(packageInfo.className)?uncap_first}) {
Example example = MapperUtils.getExampleByClass(${packageInfo.className}.class, ${(packageInfo.className)?uncap_first});
return ${(packageInfo.className)?uncap_first}Mapper.selectByExample(example);
}

public void create(${packageInfo.className} ${(packageInfo.className)?uncap_first}) {
${(packageInfo.className)?uncap_first}Mapper.insert(${(packageInfo.className)?uncap_first});
}

public void update(${packageInfo.className} ${(packageInfo.className)?uncap_first}) {
${(packageInfo.className)?uncap_first}Mapper.updateByPrimaryKey(${(packageInfo.className)?uncap_first});
}

public ${packageInfo.className} select(String id) {
return ${(packageInfo.className)?uncap_first}Mapper.selectByPrimaryKey(id);
}

public void delete(String ids) {
${(packageInfo.className)?uncap_first}Mapper.deletes(Arrays.asList(ids.split(",")));
}
}
